package com.fary.controller;

import com.alibaba.fastjson.JSONArray;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;

/**
 * @author Fary
 * @version 1.0
 * @description: TODO
 * @date 2022/3/13 17:47
 */
public class ModelAttributeController {

    @ModelAttribute("top")
    public Map top() {
//        return pageTop.getDataMap();
        return null;
    }

    @RequestMapping({"", "/", "/home"})
    public String home(@RequestBody(required = false) Map<String, Object> param, Model model) {
//        model.addAttribute("model", dataAssembly.homePageData(param));
        return "home";
    }
    @RequestMapping("/test")
    public String test(@ModelAttribute("top") Map top, Model model) {
//        JSONArray ja  = JSONArray.fromObject(map);
        return "test";
    }
}
